﻿using EFEntity;
using Model;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Iservices;
using System.Linq;

namespace Services
{
   public class config_major_kindServices: Iconfig_major_kindServices
    {
        private readonly MyDbContext myDBContext;

        public config_major_kindServices(MyDbContext myDBContext)
        {
            this.myDBContext = myDBContext;
        }
        //查看全部
        public async Task<List<config_major_kind>> config_major_kindSelect()
        {
            List<Econfig_major_kind> list = new List<Econfig_major_kind>();
            await Task.Run(() =>
            {
                list = myDBContext.config_major_kind.ToList();
            });

            //Automap
            List<config_major_kind> list2 = new List<config_major_kind>();
            foreach (Econfig_major_kind item in list)
            {
                config_major_kind t = new config_major_kind()
                {
                    mfk_id =item.mfk_id,
                    major_kind_id =item.major_kind_id,
                    major_kind_name =item.major_kind_name
                }; 
                list2.Add(t);
            }
            return list2;
        }

        public async Task<List<config_major_kind>> majorSelect()
        {
            List<Econfig_major_kind> list = new List<Econfig_major_kind>();
            await Task.Run(() =>
            {
                list = myDBContext.config_major_kind.ToList();
            });

            //Automap
            List<config_major_kind> list2 = new List<config_major_kind>();
            foreach (Econfig_major_kind item in list)
            {
                config_major_kind t = new config_major_kind()
                {
                    mfk_id = item.mfk_id,
                    major_kind_id = item.major_kind_id,
                    major_kind_name = item.major_kind_name,
                };
                list2.Add(t);
            }
            return list2;
        }
    }
}
